﻿using System;
using System.Windows.Forms;
using VentaElectrodomesticos.Utilities;
using System.Collections.Generic;

namespace VentaElectrodomesticos.AbmCliente
{
    public class Cliente
    {
        public int id;
        public String dni;
        public String nombre;
        public String apellido;
        public String mail;
        public String telefono;
        public String direccion;
        public KeyValuePair provincia;
        public char status;

        public Cliente() {/*Constructor por defecto*/}

        public Cliente(DataGridViewRow row)
        {
            this.setearConRow(row);
        }

        public void setearConRow(DataGridViewRow row)
        {
            this.id = (int)row.Cells["id"].Value;
            this.dni = row.Cells["dni"].Value.ToString();
            this.nombre = row.Cells["nombre"].Value.ToString();
            this.apellido = row.Cells["apellido"].Value.ToString();
            this.mail = row.Cells["mail"].Value.ToString();
            this.telefono = row.Cells["telefono"].Value.ToString();
            this.direccion = row.Cells["direccion"].Value.ToString();
            if (!row.Cells["idProvincia"].FormattedValue.Equals(""))
            {
                this.provincia = new KeyValuePair((int)row.Cells["idProvincia"].Value, row.Cells["provincia"].Value.ToString());
            }
            else
            {
                this.provincia = new KeyValuePair(0,"");
            }
            this.status = Convert.ToChar(row.Cells["status"].Value);
        }
    }
}
